package com.itcam.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

/**
 * Author:Cammy.Wu
 * Date:2024-04-29
 * Description:
 */
@Controller
public class HelloController {
    //handler -> springmvc/hello return "hello springmvc!"

    /**
     * handler就是controller内部的具体方法
     *  //@RequestMapping("/springmvc/hello") 就是用来向handlerMapping中注册的方法注解!
     *  //@ResponseBody 代表向浏览器直接返回数据!
     */

    @RequestMapping("springmvc/hello")
    @ResponseBody // 直接返回字符串给前端，不要找视图解析器！！！
    public String hello(){
        System.out.println("HelloController.hello");

        // 返回给前端
        return "hello springmvc!";
    }
}
